<template>
  <div class="empty-state">
    <div class="empty-icon">
      <i :class="icon"></i>
    </div>
    <div class="empty-text">{{text}}</div>
    <div class="empty-action" v-if="showAction">
      <el-button type="primary" size="small" @click="$emit('action-click')">{{actionText}}</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'EmptyState',
  props: {
    text: {
      type: String,
      default: '暂无数据'
    },
    icon: {
      type: String,
      default: 'el-icon-document'
    },
    showAction: {
      type: Boolean,
      default: false
    },
    actionText: {
      type: String,
      default: '添加数据'
    }
  }
}
</script>

<style scoped>
.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.empty-icon {
  font-size: 48px;
  color: #909399;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 14px;
  color: #909399;
  margin-bottom: 16px;
}

.empty-action {
  margin-top: 8px;
}
</style> 